﻿using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Web.Security;

namespace Heroius.ArtechWCF.Server
{
    [ServiceBehavior(Namespace = "http://www.artech.com/"), AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class RoleService : IRoleService
    {
        public RoleProviderData GetProviderData()
        {
            return new RoleProviderData()
            {
                ApplicationName = Roles.ApplicationName
            };
        }

        public void AddUsersToRoles(string[] usernames, string[] roleNames)
        {
            Roles.AddUsersToRoles(usernames, roleNames);
        }

        public void CreateRole(string roleName)
        {
            Roles.CreateRole(roleName);
        }

        public bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            return Roles.DeleteRole(roleName, throwOnPopulatedRole);
        }

        public string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            return Roles.FindUsersInRole(roleName, usernameToMatch);
        }

        public string[] GetAllRoles()
        {
            return Roles.GetAllRoles();
        }

        public string[] GetRolesForUser(string username)
        {
            return Roles.GetRolesForUser(username);
        }

        public string[] GetUsersInRole(string roleName)
        {
            return Roles.GetUsersInRole(roleName);
        }

        public bool IsUserInRole(string username, string roleName)
        {
            return Roles.IsUserInRole(username, roleName);
        }

        public void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
        {
            Roles.RemoveUsersFromRoles(usernames, roleNames);
        }

        public bool RoleExists(string roleName)
        {
            return Roles.RoleExists(roleName);
        }
    }
}
